package com.mazaiting.gateway.router;

import com.mazaiting.common.core.domain.result.Result;
import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.BodyInserters;
import org.springframework.web.reactive.function.server.HandlerFunction;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;

/**
 * 测试处理器
 */
@Slf4j
@Component
public class TestHandler implements HandlerFunction<ServerResponse> {

    @Override
    @NonNull
    public Mono<ServerResponse> handle(@NonNull ServerRequest request) {
        log.info("网关测试路由");
        return ServerResponse.ok().body(BodyInserters.fromValue(Result.success()));
    }
}
